﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Entities.Admin;

namespace WindowsForms.Admin
{
    public partial class FormReportTaiKhoan : Form
    {
        int mabp;
        bool state = true;
        public FormReportTaiKhoan()
        {
            InitializeComponent();
        }

        private void FormReportTaiKhoan_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads .todata into the 'DLTaiKhoanAll.View_TaiKhoan' table. You can move, or remove it, as needed.
            LoadComBobox(GiaiDau.Objects.All().ToList());

        }

        private void btnreport_Click(object sender, EventArgs e)
        {
            if (!state)
            {
                UcRpTaiKhoan.ma = mabp;
                pnnoidunght.Controls.Clear();
                UcRpTaiKhoan dr = new UcRpTaiKhoan();

                dr.Dock = System.Windows.Forms.DockStyle.Fill;
                pnnoidunght.Controls.Add(dr);
            }
            
        }
        private void LoadComBobox(List<GiaiDau> ds)
        {
            cbbbophan.Items.Clear();
            foreach (var item in ds)
                cbbbophan.Items.Add(item);
            cbbbophan.DisplayMember = "TenGiaiDau";
            cbbbophan.ValueMember = "MaGiaiDau";
            cbbbophan.Items.Insert(0, "-- Giải Đấu--");
            cbbbophan.SelectedIndex = 0;


        }

        private void cbbbophan_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbbbophan.SelectedIndex > 0)
            {
                state = false;
                mabp = (cbbbophan.SelectedItem as GiaiDau).MaGiaiDau;

            }
            else
            {
                state = true;
            }
        }

        private void btnthoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
